import request from '@/utils/request'

// 查询拼团商品信息列表
export function listGroup(query) {
  return request({
    url: '/admin/SGroup/goodsGroupList',
    method: 'get',
    params: query
  })
}

// 查询拼团商品信息列表(选择链接)
export function listChooseGroup(query) {
  return request({
    url: '/admin/SGroup/groupChooseList',
    method: 'get',
    params: query
  })
}

// 查询拼团商品信息详细
export function getGroup(goodsGroupId) {
  return request({
    url: '/admin/SGroup/goodsGroupDetails/group/' + goodsGroupId,
    method: 'get'
  })
}

// 新增拼团商品信息
export function addGroup(data) {
  return request({
    url: '/admin/SGroup/goodsGroupAdd',
    method: 'post',
    data: data
  })
}

// 修改拼团商品信息
export function updateGroup(data) {
  return request({
    url: '/admin/SGroup/goodsGroupEdit',
    method: 'put',
    data: data
  })
}

// 删除拼团商品信息
export function delGroup(goodsGroupId) {
  return request({
    url: '/admin/SGroup/goodsGroupDel/group/' + goodsGroupId,
    method: 'delete'
  })
}

// 拼团商品状态修改
export function changeGoodsGroupStatus(goodsGroupId, goodsStatus, goodsId) {
  const data = {
    goodsGroupId,
    goodsStatus,
    goodsId,
  }
  return request({
    url: '/admin/SGroup/changeStatus',
    method: 'put',
    data: data
  })
}

// 查询拼团玩法详情
export function getgoodsGroupPlay(goodsGroupPlayId) {
  return request({
    url: '/admin/SGroup/goodsGroupPlayDetails/goodsGroupPlayId/' + goodsGroupPlayId,
    method: 'get'
  })
}

// 修改拼团玩法详情
export function updateGoodsGroupPlay(data) {
  return request({
    url: '/admin/SGroup/goodsGroupPlayEdit',
    method: 'put',
    data: data
  })
}
